Projects

GPS Logger
Room
   Thermostat
Projects

LCD Drivers
Electronic
Ktulu's
Projects
GPS to SD card data logger and compass
Earlier this year I have bought on the flea market a used car GPS system, an Amstrad gp1000.
(Un)fortunately it was so badly damaged, that it could not be  repaired, so I thought I would reuse some parts from it. Then came the idea of building a portable GPS logger system.
The receiver runs perfectly from 3.3V, based on the NMEA V2. 2, 9600, 8, N, 1 protocol with a refresh rate of up to 1Hz and 16 channels. I've also reused the built in Li-polymer 1500mAh battery, some passive parts and connectors.
Hardware
The whole unit was built from reused parts except for the two buttons, the Maxim MAX1811 battery charging IC, and the Linear Technology LTC3440 buck-boost DC/DC converter.
The LTC3440 generates a 3.5V voltage from a single cell Li-polymer battery. There is no real power switch, the unit is turned on and off from software.  After removing power from the SD card and GPS using a single transistor Q1, the MCU enters sleep mode.

I have a 5V powered programming hardware, so a jumper is used to disconnect the rest of the circuit while upgrading the firmware.
The GPS unit originally used a tiny 3V Li-Ion cell for backup, which I've replaced with a schottky diode connected to the 3.5V line.
The AN0 analog input pin of the microcontroller is used for battery level measurment both in normal operation and during charging. The MAX1811 has a charge output pin which is used to detect the start and finish of a charging process.
Power consumption in sleep mode is around 1.5mA, while in active state between 60 to 70mA.
First thing I did was to solder the finest pin spacing component of 0.5mm, the LTC3440.
It was impossible to do the job right, without using some paper tape to cover the neighboring pins. The PCB is home made with toner transfer method, and no solder mask.

After installing the power supply and charging circuits, I've tested for proper functioning.
The case was borrowed from an old broken digital multimeter. :)
Hot glue was ideal for mounting the GPS receiver antenna and the LCD display.
Software

The software was entierly written in MikroPascal 4.6.
By pressing the select button for more than 2 seconds, the unit will exit sleep mode. Right away it checks the battery voltage level, and switches off if it does not reach 3V.
During initialization the battery voltage is shown on the bottom side of the screen. This happens only on startup.
The MCU then powers up the GPS unit, SD card, and checks for FAT16 file system. If it can't find one, it will turn off logging along with a warning message and sound. The SD card can be formatted later from menu though.
In high priority interrupt, a statemachine fills up two arrays with GPGGA and GPRMC NMEA sentences every second. It also checks for a GPS fix, and signals using a flag to the main routine.
The main routine is responsible for the actual logging, but this will only happen, if there is a valid sattelite fix, logging is turned on, and the unit is moving.
I used the sector write method instead of normal file handling becouse it is much much faster, and writing speed does not vary with file size. Therefore on every powerup, the system creates a new file in size of 6.5MBytes, that can hold around 10 hours of data.
Filename is in the format of ddmmyyhh.txt. (dd=day, mm=month, yy=year, hh=hour)
The main screen shows various useful information. In 1st row the number of satellites, whether there is a fix or not, log status and battery level.  A "+" sign will appear next to battery every time the unit writes the SD card.
Battery voltage is constatntly monitored. If it drops below 3.17V, the unit will emit a warning sound every 5 minutes, and show an empty blinking battery symbol. If voltage drops even further, and reaches 3V, the MCU will power off the unit.
Finally the 6th row displays local  (to my country) daylightsaving time, and date. Short pressing any button, will switch to second screen, the compass. Bottom row also shows heading in degrees. Pressing select button for more than 1.5s, the menu will show up. Here I can turn logging off for example if I need to change memory card; adjust contrast; format memory card, or switch the unit off.  If no key is pressed for more than 15 seconds, it will automatically exit menu, and remembers the last position it was on.  I am unable to mention here all the tiny details, but you can freely download the whole software package further below.
The fun part

I am using GPSVisualizer combined with Google Maps to view my tracks.
It has a lot of nice features like coloring your track by distance, altitude, speed, number of satellites.
Here you can see a couple of images recorded while I was walking around my town.
On the left side picture, the track is colored by elevation.
The other one is colored by distance.
GPSVisualizer link
Log files
Complete Sourcecode
Youtube video link
2nd row latitude, 3rd row longitude, 4th row speed converted to km/h and altitude in meters.
For convenience, I usually keep it in my jacket's front pocket in vertical position.
Problems usually occur only in the vicinity of tall buildings or in woods due to reflected signals.
Copyright © 2011 Ktulu.

Feel free to use my photos, any part of sourcecode or schematics, but please mention me as the original author.